<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/doc/src/qmake-manual.qdoc -->
<head>
  <title>Qt 4.3: qmake Platform Notes</title>
  <link rel="prev" href="qmake-running.html" />
  <link rel="contents" href="qmake-manual.html" />
  <link rel="next" href="qmake-advanced-usage.html" />
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><p>
[Previous: <a href="qmake-running.html">Running qmake</a>]
[<a href="qmake-manual.html">Contents</a>]
[Next: <a href="qmake-advanced-usage.html">qmake Advanced Usage</a>]
</p>
<h1 align="center">qmake Platform Notes<br /><small></small></h1>
<p>Many cross-platform projects can be handled by the <tt>qmake</tt>'s basic configuration features. On some platforms, it is sometimes useful, or even necessary, to take advantage of platform-specific features. <tt>qmake</tt> knows about many of these features, and these can be accessed via specific variables that only have an effect on the platforms where they are relevant.</p>
<ul><li><a href="#mac-os-x">Mac OS X</a></li>
<ul><li><a href="#source-and-binary-packages">Source and Binary Packages</a></li>
<li><a href="#using-frameworks">Using Frameworks</a></li>
<li><a href="#creating-library-bundles">Creating Library Bundles</a></li>
<li><a href="#creating-frameworks">Creating Frameworks</a></li>
<li><a href="#creating-universal-binaries">Creating Universal Binaries</a></li>
<li><a href="#creating-and-moving-xcode-projects">Creating and Moving Xcode Projects</a></li>
</ul>
<li><a href="#windows">Windows</a></li>
<ul><li><a href="#creating-visual-studio-project-files">Creating Visual Studio Project Files</a></li>
<li><a href="#visual-studio-2005-manifest-files">Visual Studio 2005 Manifest Files</a></li>
</ul>
</ul>
<a name="mac-os-x"></a>
<h2>Mac OS X</h2>
<p>Features specific to this platform include support for creating universal binaries, frameworks and bundles.</p>
<a name="source-and-binary-packages"></a>
<h3>Source and Binary Packages</h3>
<p>The version of <tt>qmake</tt> supplied in source packages is configured slightly differently to that supplied in binary packages in that it uses a different feature specification. Where the source package typically uses the <tt>macx-g++</tt> specification, the binary package is typically configured to use the <tt>macx-xcode</tt> specification.</p>
<p>Users of each package can override this configuration by invoking <tt>qmake</tt> with the <tt>-spec</tt> option (see <a href="qmake-running.html">Running qmake</a> for more information). This makes it possible, for example, to use <tt>qmake</tt> from a binary package to create a Makefile in a project directory with the following command line invocation:</p>
<pre> qmake -spec macx-g++</pre>
<a name="using-frameworks"></a>
<h3>Using Frameworks</h3>
<p><tt>qmake</tt> is able to automatically generate build rules for linking against frameworks in the standard framework directory on Mac OS X, located at <tt>/Library/Frameworks/</tt>.</p>
<p>Directories other than the standard framework directory need to be specified to the build system, and this is achieved by appending linker options to the <a href="qmake-variable-reference.html#qmake-lflags">QMAKE_LFLAGS</a> variable, as shown in the following example:</p>
<pre> QMAKE_LFLAGS += -L/path/to/framework/directory/</pre>
<p>The framework itself is linked in by appending the <tt>-framework</tt> options and the name of the framework to the <a href="qmake-variable-reference.html#libs">LIBS</a> variable:</p>
<pre> LIBS += -framework TheFramework</pre>
<a name="creating-library-bundles"></a>
<h3>Creating Library Bundles</h3>
<p>Any given library project can be configured so that the resulting library file is placed in a library bundle, ready for deployment. To do this, set up the project to use the <a href="qmake-variable-reference.html#template"><tt>lib</tt> template</a> and add the <tt>lib_bundle</tt> option to the <a href="qmake-variable-reference.html#config">CONFIG</a> variable:</p>
<pre> TEMPLATE = lib
 CONFIG += lib_bundle</pre>
<p>The data associated with the library is specified using the <a href="qmake-variable-reference.html#qmake-bundle-data">QMAKE_BUNDLE_DATA</a> variable. This holds items that will be installed with a library bundle, and is often used to specify a collection of header files, as in the following example:</p>
<pre> FRAMEWORK_HEADERS.version = Versions
 FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h
 FRAMEWORK_HEADERS.path = Headers
 QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS</pre>
<p>Here, the <tt>FRAMEWORK_HEADERS</tt> variable is a user-defined variable that is used to define the headers required to use a particular framework. Appending it to the <tt>QMAKE_BUNDLE_DATA</tt> variable ensures that the information about these headers are added to the collection of resources that will be installed with the library bundle.</p>
<p>See <a href="deployment-mac.html">Deploying an Application on Qt/Mac</a> for more information about deploying applications and libraries.</p>
<a name="creating-frameworks"></a>
<h3>Creating Frameworks</h3>
<p>In addition to libraries and library bundles, <tt>qmake</tt> can generate rules to build frameworks.</p>
<p>To enable this, you need to configure the project to generate a library bundle as described in the previous section:</p>
<pre>     TEMPLATE = lib
     CONFIG += lib_bundle</pre>
<p>The end product of the build process is a framework whose name and version are specified by the <a href="qmake-variable-reference.html#qmake-framework-bundle-name">QMAKE_FRAMEWORK_BUNDLE_NAME</a> and <a href="qmake-variable-reference.html#qmake-framework-version">QMAKE_FRAMEWORK_VERSION</a> variables. By default, the values used for these are obtained from the <a href="qmake-variable-reference.html#target">TARGET</a> and <a href="qmake-variable-reference.html#version">VERSION</a> variables.</p>
<p>See <a href="deployment-mac.html">Deploying an Application on Qt/Mac</a> for more information about building and deploying frameworks.</p>
<a name="creating-universal-binaries"></a>
<h3>Creating Universal Binaries</h3>
<p>To create a universal binary for your application, you need to be using a version of Qt that has been configured with the <tt>-universal</tt> option.</p>
<p>The architectures to be supported in the binary are specified with the <a href="qmake-variable-reference.html#config">CONFIG</a> variable. For example, the following assignment causes <tt>qmake</tt> to generate build rules to create a universal binary for both PowerPC and x86 architectures:</p>
<pre>     CONFIG += x86 ppc</pre>
<p>Additionally, developers using a PowerPC-based platform need to set the <a href="qmake-variable-reference.html#qmake-mac-sdk">QMAKE_MAC_SDK</a> variable. This process is discussed in more detail in the <a href="deployment-mac.html#architecture-dependencies">deployment guide for Mac OS X</a>.</p>
<a name="creating-and-moving-xcode-projects"></a>
<h3>Creating and Moving Xcode Projects</h3>
<p>Developers on Mac OS X can take advantage of <tt>qmake</tt>'s support for Xcode project files, as described in <a href="qtmac-as-native.html#development-tools">Qt/Mac is Mac OS X Native</a>, by running <tt>qmake</tt> to generate an Xcode project from an existing <tt>qmake</tt> project files. For example:</p>
<pre> qmake -spec macx-xcode project.pro</pre>
<p>Note that, if a project is later moved on the disk, <tt>qmake</tt> must be run again to process the project file and create a new Xcode project file.</p>
<a name="windows"></a>
<h2>Windows</h2>
<p>Features specific to this platform include support for creating Visual Studio project files and handling manifest files when deploying Qt applications developed using Visual Studio 2005.</p>
<a name="creating-visual-studio-project-files"></a>
<h3>Creating Visual Studio Project Files</h3>
<p>Developers using Visual Studio to write Qt applications can use the Visual Studio integration facilities provided with the <a href="commercialeditions.html">Qt Commercial Editions</a> and do not need to worry about how project dependencies are managed.</p>
<p>However, some developers may need to import an existing <tt>qmake</tt> project into Visual Studio. <tt>qmake</tt> is able to take a project file and create a Visual Studio project that contains all the necessary information required by their development environment. This is achieved by setting the <tt>qmake</tt> <a href="qmake-variable-reference.html#template">project template</a> to either <tt>vcapp</tt> (for application projects) or <tt>vclib</tt> (for library projects).</p>
<p>This can also be set using a command line option; for example:</p>
<pre> qmake -t vcapp</pre>
<p>Each time you update the project file, you need to run <tt>qmake</tt> to generate an updated Visual Studio project.</p>
<a name="visual-studio-2005-manifest-files"></a>
<h3>Visual Studio 2005 Manifest Files</h3>
<p>When deploying Qt applications built using Visual Studio 2005, it is necessary to ensure that the manifest file, created when the application was linked, is handled correctly. This is handled automatically for projects that generate DLLs, but it is necessary to explicitly enable manifest embedding for application executables with the following assignment to the <a href="qmake-variable-reference.html#config">CONFIG</a> variable:</p>
<pre>     CONFIG += embed_manifest_exe</pre>
<p>This is discussed in more detail in the <a href="deployment-windows.html#visual-studio-2005">deployment guide for Windows</a>.</p>
<p>
[Previous: <a href="qmake-running.html">Running qmake</a>]
[<a href="qmake-manual.html">Contents</a>]
[Next: <a href="qmake-advanced-usage.html">qmake Advanced Usage</a>]
</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
